package com.ranjiaqi.arrays;

import java.util.Arrays;

/**
 * @ClassName TestBinarySearch
 * @Description TODO
 * @Author hp
 * @Date 2021/6/21 19:18
 * @Version 1.0
 **/
public class TestBinarySearch {
    public static void main(String[] args) {
        int[] arr = {1,3,5,7,9,10,11};
        //搜索要查找的key的下标，如果找到返回索引值，没找到返回-（排序位置索引）-1
        System.out.println("Arrays.binarySearch(arr,7) = " + Arrays.binarySearch(arr, 7));
    }
}
